package com.jservice.framework.freemarker.directive;

import com.jservice.framework.utils.FreemarkerUtils;
import freemarker.core.Environment;
import freemarker.template.TemplateDirectiveBody;
import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;

import java.io.IOException;
import java.util.Map;

/**
 * Created by yixiaoxiao on 16/5/14.
 */
public class FooterDirective extends BaseDirective {

    /** "tabIndex"参数名称 */
    private static final String TABINDEX_PARAMETER_NAME = "tabIndex";

    /** "tabIndex"变量名称 */
    private static final String TABINDEX_VARIABLE_NAME = "tabIndex";

    @SuppressWarnings({ "unchecked", "rawtypes" })
	@Override
    public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException {
        Integer tabIndex = FreemarkerUtils.getParameter(TABINDEX_PARAMETER_NAME, Integer.class, params);
        setLocalVariable(TABINDEX_VARIABLE_NAME,tabIndex,env, body);
    }

}
